package leetcode.tree;

import leetcode.tree.common.TreeNode;
import leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode(int x) { val = x; }
 * }
 */
class SolutionOffer27 {
    public TreeNode mirrorTree(TreeNode root) {
        return TreeUtils.mirrorTree(root);
    }
}

/**
 * 	#剑指 Offer 27 二叉树的镜像
 */
public class offer27 {
    public static void main(String[] args) {
        SolutionOffer27 solutionOffer27 = new SolutionOffer27();
        Integer[] nums = {4, 2, 7, 1, 3, 6, 9};
        TreeNode root = solutionOffer27.mirrorTree(TreeUtils.generateLeetcodeTree(nums));
        System.out.println(TreeUtils.getLeetcodeTreeVals(root));
    }
}
